package net.m510.autosurfer.sonybank;

import java.net.URI;
import java.util.List;
import java.util.logging.Logger;

import net.m510.autosurfer.common.DocumentPostProcess;
import net.m510.autosurfer.core.Parameters;
import net.m510.autosurfer.core.utils.AnalyzeUtils;

import org.apache.http.NameValuePair;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.impl.client.CloseableHttpClient;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.FormElement;

public class SonyBankAnnouncement extends DocumentPostProcess {
	private static final Logger log = Logger.getLogger(SonyBankAnnouncement.class.getName());

	public SonyBankAnnouncement() {
		this(null,null);
	}
	
	public SonyBankAnnouncement(CloseableHttpClient client,HttpClientContext context) {
		super(client, context);
		super.log = log;
	}

	@Override
	protected URI getUri(Document doc) {
		return AnalyzeUtils.resolveURIByPath(context, "/TDGate/gate/NBW010003/&NBP000140G01");
	}

	@Override
	protected List<NameValuePair> getRequestParameters(Document doc) {
		FormElement form = doc.getAllElements().forms().get(0);
		Parameters p = Parameters.create(form);
		p.put("__fid", "NBP000140");
		p.put("__gid", "NBP000140G01");
		p.put("B_ID", "4");
		return p.asNameValueList();
	}
}
